package model.input;

public class InputWords {
	
	
	private String word1;
	private String word2;
	private String word3;
	private String word4;
	
	//"r" introduced so input can be compared to identifiers
	public InputWords() 
	{
		this.word1 = "r";
		this.word2 = "r";
		this.word3 = "r";
		this.word4 = "r";
	}
	public InputWords(InputWords _inputWords)
	{
		this.word1 = _inputWords.getWord1();
		this.word2 = _inputWords.getWord2();
		this.word3 = _inputWords.getWord3();
		this.word4 = _inputWords.getWord4();
	}
	// This function makes it easy to add a word
	// when you don't know how many have been set
	public void add(String s)
	{
		if(word1 == null || word1 == "r")
		{
			word1 = s;
			return;
		}
		if(word2 == null || word2 == "r")
		{
			word2 = s;
			return;
		}
		if(word3 == null || word3 == "r")
		{
			word3 = s;
			return;
		}
		if(word4 == null || word4 == "r")
		{
			word4 = s;
			return;
		}
	}
	public String getWord1() {
		return word1;
	}
	public void setWord1(String word1) {
		this.word1 = word1.toUpperCase();
	}
	public String getWord2() {
		return word2;
	}
	public void setWord2(String word2) {
		this.word2 = word2.toUpperCase();
	}
	public String getWord3() {
		return word3;
	}
	public void setWord3(String word3) {
		this.word3 = word3.toUpperCase();
	}
	public String getWord4() {
		return word4;
	}
	public void setWord4(String word4) {
		this.word4 = word4.toUpperCase();
	}
	
	public String cutNextNonNull()
	{
		String temp = null;
		if( word1 != null )
		{
			temp = word1;
			word1 = null;
			return temp;
		}
		if( word2 != null )
		{
			temp = word2;
			word2 = null;
			return temp;
		}
		if( word3 != null )
		{
			temp = word3;
			word3 = null;
			return temp;
		}
		if( word4 != null )
		{
			temp = word4;
			word4 = null;
			return temp;
		}
		return temp;
	}
	// Now you can do System.out.println(InputWords);
	public String toString()
	{
		String out = "";
		if(word1 != null) out += word1 + " ";
		if(word2 != null) out += word2 + " ";
		if(word3 != null) out += word3 + " ";
		if(word4 != null) out += word4 + " ";
		return out.trim();
	}
	// This is becoming increasingly redundant
	public void vomit(){
		System.out.println(word1);
		System.out.println(word2);
		System.out.println(word3);
		System.out.println(word4);
	}
	
	
}
